﻿using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SenFangKaoHe_MVC.Models.Entity;
using SenFangKaoHe_MVC.Services;
using SqlSugar;
using System.Diagnostics;

namespace SenFangKaoHe_MVC.Controllers
{
    public class KaoShiController : Controller
    {
        private readonly SqlSugarClient db;
        public KaoShiController(SqlSugarClient db)
        {
            this.db = db;
        }
        public IActionResult Index()
        {
            return View();
        }

        public async Task<IActionResult> KaoShi(int khid,string xm)
        {
            kaohe kh = await new KaoShiServices(db).getKaoHe(khid);
            Debug.WriteLine(JsonConvert.SerializeObject(kh));
            return View(kh);
        }

        public async Task<List<tikukaoti>> getKaoTi(int[] tkids, int[] txs, int[] tls)
        {

            return await new KaoShiServices(db).getKaoTi(tkids, txs, tls);
        }
    }
}
